﻿namespace MyK3CloudCore.IOC.DataEntity
{
    /// <summary>
    /// 单据编号
    /// </summary>
    public interface IK3Number
    {
        string ToString();
    }

    /// <summary>
    /// 单据编号
    /// </summary>
    public class K3Number : IK3Number
    {
        public string FNumber { get; set; }

        /// <summary>
        /// 单据编号
        /// </summary>
        public K3Number(string fNumber)
        {
            FNumber = fNumber;
        }

        public override string ToString()
        {
            return $"{{\"FNumber\": \"{this.FNumber}\"}}";
        }

        /// <summary>
        /// 单据编号
        /// </summary>
        public static K3Number? Parse(string fnumber)
        {
            if (string.IsNullOrEmpty(fnumber)) { return null; }
            return new(fnumber);
        }
    }
    /// <summary>
    /// 用户
    /// </summary>
    public class K3User : IK3Number
    {
        public int FUserID { get; set; }

        public K3User(int FUserID)
        {
            this.FUserID = FUserID;
        }
        public override string ToString()
        {
            return $"{{\"FUSERID\": {this.FUserID}}}";
        }
        /// <summary>
        /// 用户内码
        /// </summary>
        public static K3User Parse(int FUserID)
        {
            return new(FUserID);
        }
    }
}
